//获取富文本所以图片的id和被删除图片id

const getRemovImgId = (ids, html) => {
  let dom = document.createElement('DIV')
  dom.innerHTML = html
  const imgDom = dom.getElementsByTagName('img')
  const url = window.location.host
  const arr=[]
  for (let i = 0; i < imgDom.length; i++) {
    if (imgDom[i].src.indexOf(url) > -1) {
      let reg = new RegExp('(^|&)id=([^&]*)(&|$)')
      let r = imgDom[i].src.split('?')[1].match(reg)
      let id=unescape(r[2])
      ids.splice(ids.indexOf(id),1)
      arr.push(id)
    }
  }
  return {
    removeIds:ids,
    imgIds:arr
  }
}
export default {
  getRemovImgId
}